package com.itmuch.cloud.microserviceconsumermovie.feign;

import com.itmuch.cloud.microserviceconsumermovie.entity.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

/********************************************************
 *@Desc: feign客户端使用
 *
 * 使用feign两个坑
 * 1、不支持GetMapping
 * 2、@PathVariable必须自定value
 * 3、如果参数是一个对象，必须用post请求，如果多个参数，必须分开写
 *@Author: ZRP
 *@Date: 2017/12/20 14:00
 ********************************************************/
@FeignClient("microservice-provider-user")
public interface UserFeignClient {

//    @GetMapping("/simple/{id}") //这种方式不行
    @RequestMapping(value = "/simple/{id}", method = RequestMethod.GET)
    public User findById(@PathVariable("id") Long id);


    @RequestMapping(value = "/user", method = RequestMethod.POST)
    public User postUser(@RequestBody User user);
}
